class Test(IViewPortScriptQuery):
    def query(self, fd_code: str, parameters: dict) -> Page:
        number = parameters.get('number', '')
        sql = """
        select *
FROM  assertbk7daysum
where number= '{}'
        """.format(number)
        result = FactDatasourceClient.query(fd_code, sql)

        dept = result[0].dept

        max_min_sql = """
        select dept, MAX(total) as max_total, MIN(total) as min_total
FROM  assertbk7daysum
GROUP BY dept
HAVING dept = '{}'
        """.format(dept)
        count_result = FactDatasourceClient.query(fd_code, max_min_sql)
        max_total = count_result[0].max_total
        min_total = count_result[0].min_total
        result[0]['max_total'] = max_total
        result[0]['min_total'] = min_total
        return Page(list=result)